/* Base styles optimized for iframe and mobile-first design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* Changed font family to Arial and increased base font size to 16px for primary school students */
    font-family: Arial, sans-serif;
    font-size: 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    width: 100%;
    height: 450px; /* Default iframe height */
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: manipulation;
}

/* Responsive height adjustment */
@media (min-width: 768px) and (min-height: 600px) {
    body {
        height: 90vh;
    }
}

.container {
    width: 100%;
    height: 100%;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Weather selector - compact horizontal layout */
.weather-selector {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.weather-card {
    background: white;
    border-radius: 12px;
    padding: 12px 16px; /* Increased padding for better visibility */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px; /* Increased gap between icon and text */
    min-height: 50px; /* Increased minimum height for better touch targets */
    border: 2px solid transparent;
}

.weather-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.weather-card.selected {
    border-color: #2196F3;
    background: #e3f2fd;
    box-shadow: 0 4px 12px rgba(33,150,243,0.3);
}

.weather-icon {
    /* Increased weather icon size for better visibility */
    font-size: 28px;
}

.weather-card span {
    /* Increased font size for weather card text */
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Main interactive area */
.main-area {
    flex: 1;
    display: flex;
    gap: 8px;
    min-height: 0;
}

/* Backpack container */
.backpack-container {
    flex: 0 0 160px; /* Increased width to accommodate larger content */
    display: flex;
    flex-direction: column;
}

.backpack {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border-radius: 16px;
    padding: 16px; /* Increased padding */
    text-align: center;
    color: white;
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 220px; /* Increased minimum height */
    border: 3px dashed transparent;
    transition: all 0.3s ease;
}

.backpack.drag-over {
    border-color: #FFC107;
    background: linear-gradient(145deg, #66BB6A, #4CAF50);
    transform: scale(1.02);
}

.backpack-icon {
    /* Increased backpack icon size significantly */
    font-size: 48px;
    margin-bottom: 12px;
}

.backpack-label {
    /* Increased backpack label font size */
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 16px;
    line-height: 1.2;
}

.items-in-bag {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px; /* Increased gap between items */
    overflow-y: auto;
}

.bag-item {
    background: rgba(255,255,255,0.9);
    color: #333;
    padding: 8px 10px; /* Increased padding */
    border-radius: 8px;
    font-size: 14px; /* Increased font size for bag items */
    display: flex;
    align-items: center;
    gap: 6px; /* Increased gap */
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px; /* Increased minimum height */
}

.bag-item:hover {
    background: rgba(255,255,255,1);
    transform: translateX(2px);
}

.bag-item.correct {
    background: rgba(76,175,80,0.2);
    border-left: 3px solid #4CAF50;
}

.bag-item.incorrect {
    background: rgba(244,67,54,0.2);
    border-left: 3px solid #f44336;
}

/* Items grid */
.items-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px; /* Increased gap */
    overflow-y: auto;
}

.item-category h3 {
    /* Increased category header font size */
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
    padding: 6px 10px; /* Increased padding */
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    text-align: center;
}

.items-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Increased minimum width */
    gap: 8px; /* Increased gap between items */
}

.item {
    background: white;
    border-radius: 12px;
    padding: 12px; /* Increased padding */
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    min-height: 90px; /* Increased minimum height significantly */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px; /* Increased gap between icon and text */
    border: 2px solid transparent;
    user-select: none;
}

.item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.item.correct-choice {
    border-color: #4CAF50;
    background: #e8f5e8;
}

.item.incorrect-choice {
    border-color: #f44336;
    background: #ffebee;
}

.item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.item-icon {
    /* Significantly increased item icon size for primary school students */
    font-size: 32px;
}

.item span {
    /* Increased item text font size */
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.1;
    text-align: center;
}

/* Feedback area */
.feedback-area {
    display: flex;
    gap: 10px; /* Increased gap */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px; /* Increased padding */
}

.score-display {
    flex: 1;
    text-align: center;
    font-weight: bold;
    color: #333;
    font-size: 16px; /* Increased font size to match base font */
    min-height: 44px; /* Increased minimum height */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    padding: 10px; /* Increased padding */
}

.check-btn, .reset-btn {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px; /* Increased padding */
    font-size: 16px; /* Increased font size to match base font */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px; /* Increased minimum height */
    box-shadow: 0 2px 8px rgba(33,150,243,0.3);
}

.check-btn:hover, .reset-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33,150,243,0.4);
}

.reset-btn {
    background: #FF9800;
    box-shadow: 0 2px 8px rgba(255,152,0,0.3);
}

.reset-btn:hover {
    background: #F57C00;
    box-shadow: 0 4px 12px rgba(255,152,0,0.4);
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 10px 14px; /* Increased padding */
    border-radius: 8px;
    font-size: 14px; /* Increased font size */
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 220px; /* Increased max width */
    text-align: center;
    line-height: 1.3;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .container {
        padding: 6px; /* Increased padding */
        gap: 8px; /* Increased gap */
    }
    
    .main-area {
        flex-direction: column;
        gap: 8px; /* Increased gap */
    }
    
    .backpack-container {
        flex: 0 0 auto;
        order: 2;
    }
    
    .backpack {
        min-height: 140px; /* Increased minimum height */
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 12px; /* Increased padding */
    }
    
    .backpack-icon {
        /* Increased mobile backpack icon size */
        font-size: 36px;
        margin-bottom: 0;
        margin-right: 10px; /* Increased margin */
    }
    
    .items-in-bag {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px; /* Increased gap */
    }
    
    .items-grid {
        order: 1;
        flex: 1;
    }
    
    .items-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px; /* Increased gap */
    }
    
    .item {
        min-height: 80px; /* Increased minimum height */
        padding: 8px; /* Increased padding */
    }
    
    .item-icon {
        /* Increased mobile item icon size */
        font-size: 24px;
    }
    
    .item span {
        /* Increased mobile item text size */
        font-size: 12px;
    }
}

/* Animation for successful completion */
@keyframes celebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.celebration {
    animation: celebration 0.6s ease-in-out;
}